require 'sinatra'
require 'digest'
require 'sinatra/base'
require 'sinatra/reloader' if development?
class App < Sinatra::Base
	set :server, :puma
	configure	:production,	:development do
		enable	:logging
	end

	get '/' do
		token = 'huangwenwei'
		signayure = params["signature"]
		timestamp = params["timestamp"]
		nonce = params["nonce"]
		echostr = params["echostr"]
		array_sort = [token,timestamp,nonce].sort.join
		sha_string = Digest::SHA1.hexdigest(array_sort)
		if params["signature"]==sha_string
			p echostr
			return echostr
		else
			return 12345
		end

	end
end

